package cn.codingtalk.tacomallinterfaceportal.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import cn.codingtalk.tacomallcommon.vo.ResponseVo;
import cn.codingtalk.tacomallcommon.dto.SendDto;
import cn.codingtalk.tacomallcommon.dto.ReturnDto;
import cn.codingtalk.tacomallinterfaceportal.entity.member.Member;
import cn.codingtalk.tacomallinterfaceportal.service.MemberService;
import cn.codingtalk.tacomallinterfaceportal.feign.MemberFeignClient;

@Service
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberFeignClient memberFeignClient;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public ResponseVo findById(int id) {
        ResponseVo<Member> responseVo = new ResponseVo<>();
        this.logger.info("MemberServiceImpl findById:" + id);
        responseVo.setMessage("get member success");
        SendDto<String, Object> sendDto = new SendDto<String, Object>();
        sendDto.put("id", id);
        ReturnDto<Member> returnDto = this.memberFeignClient.findById(sendDto);
        responseVo.setData(returnDto.getData());
        return responseVo;
    }
}
